//如果用uni请求
// import http from './http.interceptor.js';

import loginApi from './api/login.js';
import userApi from './api/user.js';
import priceApi from './api/price.js';
import orderApi from './api/order.js';
import fileApi from './api/file.js';
import invoiceApi from './api/invoice.js';
import couponApi from './api/coupon.js';
import tenantApi from './api/tenant.js';

//如果是用uview请求,就用下面这句
const http = uni.$u.http

const api = {
	
	// 充电站列表相关接口
	chargingList: data => http.post('/charging-station/list', data), // 按条件查询充电站列表
	
	// 常用电站列表
	chargingUsedList: data => http.post('/charging-station/used', data),
	
	// 指定电站下的充电桩
	chargingStationList: data => http.post('/charging-pile/byStationId', data),
	
	// 充电桩终端详情
	chargingStationInfo: data => http.get('/charging-pile/' + data.id),
	
	// 充电站详情
	chargingDetail: data => http.post('/charging-station/list', data),
	
	// 电站详情
	getChargingStation: params => http.get('/charging-station/' + params.id, {params}),
	
	// 电站使用状态统计
	chargingStatusCount: data => http.post('/charging-pile/count/' + data.stationId, data),
	
	// 获取筛选条件分类
	dictData: data => http.get('/charging-station/label', {params: data}),
	
	// 电站评论列表
	stationCommentList: params => http.get('/station-comment/list', {params}),
	
	// 新增电站评论
	addStationComment: data => http.post('/station-comment/add', data),
	
	// 收藏的电站列表
	stationFavoriteList: data => http.post('/user-favorite/list', data),
	
	// 收藏电站
	addStationFavorite: params => http.get('/user-favorite/add/' + params.stationId, { params }),
	
	// 取消收藏电站
	cancelStationFavorite: params => http.delete('/user-favorite/remove?stationId=' + params.stationId),
	
	// 获取地区列表
	areaTreeList: params => http.get('/system/area/tree', { params }),
	
	// 创建充电订单
	chargingOrderCreate: data => http.post('/charging-order/create', data),
	
	// 获得文章详情
	getArticle: params => http.get('/promotion/article/get', { params }),
	
	// 获取轮播图接口
	getBannerList: params => http.get('/promotion/banner/list?position=' + params.position, { params }),
	
	// 检查App更新
	checkAppVersion: params => http.get('/app-version/checkUpdate', { params }),
	
	// 测试电站列表
	testChargingList: data => http.post('/charging-station/test', data),
	
	// 根据充电桩编号获取充电桩id 
	getPileId: params => http.get('/charging-pile/pileId', { params }),
	
	// 注册登录相关接口
	...loginApi,
	
	// 用户相关接口
	...userApi,
	
	// 价格接口
	...priceApi,
	
	// 订单接口
	...orderApi,
	
	// 文件上传接口
	...fileApi,
	
	// 发票相关接口
	...invoiceApi,
	
	// 优惠券相关接口
	...couponApi,
	
	...tenantApi
}

export default api;